package store

import "fmt"

type IKVCmdFactory interface {
	OfTag(tag int) IKVCmd
}

type tDefaultCmdFactory int

const gPutCmdTag = 1
const gDelCmdTag = 2

func (me *tDefaultCmdFactory) OfTag(tag int) IKVCmd {
	switch tag {
	case gPutCmdTag:
		return new(PutCmd)

	case gDelCmdTag:
		return new(DelCmd)
	}

	panic(fmt.Sprintf("unknown tag: %d", tag))
}

var gCmdFactory = new(tDefaultCmdFactory)
